#include "LogoUtility.h"
#include <QFile>

LogoUtility *LogoUtility::getInstance()
{
    static LogoUtility singleton{};
    return &singleton;
}

void LogoUtility::addLogoLabel(QLabel *label)
{
    g_labels.append(label);
}

void LogoUtility::loadLogo()
{
    bool flag = false;
    QFile file("/home/root/logo/logo.png");

    if (file.exists())
        flag = true;

    for (int i = 0; i < g_labels.size(); i++) {
        if (flag) {
            /* 使用用户logo */
            g_labels.at(i)->setStyleSheet(QStringLiteral("image: url(/home/root/logo/logo.png);"));
        } else {
            /* 使用默认logo */
            g_labels.at(i)->setStyleSheet(QStringLiteral("image: url(:/image/image/logo.png);"));
        }
    }
}

LogoUtility::LogoUtility() {

}
